package com.bougaga.samplespringcloud.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;

import com.bougaga.samplespringcloud.gateway.filter.ExceptionFilter;
import com.bougaga.samplespringcloud.gateway.filter.MyZuulFilter;

/**
 * 这里用了@SpringCloudApplication注解，之前没有提过，通过源码我们看到，它整合了@SpringBootApplication、@EnableDiscoveryClient、@EnableCircuitBreaker，主要目的还是简化配置
 * @author bougaga
 *
 */
@SpringBootApplication
@EnableZuulProxy
public class ZuulApplication {

	public static void main(String[] args) {
		SpringApplication.run(ZuulApplication.class, args);
	}
	
	/**
	 * 启用此过滤以后，必须在请求时加上 参数     accessToken=?
	 * @return
	 */
	/*@Bean
	public MyZuulFilter myZuulFilter(){
		return new MyZuulFilter();
	}*/
	
	/**
	 * 统一异常处理过滤                启用此过滤以后  会将异常返回给前端
	 * @return
	 */
	/*@Bean
	public ExceptionFilter exceptionFilter(){
		return new ExceptionFilter();
	}*/
}
